import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:scheme/scheme.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  // Platform messages are asynchronous, so we initialize in an async method.
  to()async{
    try {
      var result = await Scheme.open('weixin://dl/business/?t=CJmLQokrGTp');
      print('------r----$result');
    } on PlatformException {
      print('---------err');
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child:  ElevatedButton(
            style: ButtonStyle(
              shape: MaterialStateProperty.all(RoundedRectangleBorder()),
              elevation: MaterialStateProperty.all(0),
            ),
            child: Text(
              '跳转',
              style: TextStyle(fontSize: 18, color: Colors.white),
            ),
            onPressed: () {
              to();
              // getOrder(goods_id);
            },
          )
        ),
      ),
    );
  }
}
